#include<stdio.h>
int main()
{
    //freopen("in.txt","r",stdin);
    int n;
    long long a;
    while (scanf("%d",&n) != EOF)
    {
        long long  min;
        long long max;
        long long sum = 0;
        int flag = 0;
        for(int i = 0; i < n; i++)
        {
            scanf("%lld",&a);
            if (!flag)
            {
                min = a;
                max = a;
                flag = 1;
            }
            if (a < min) min = a;
            if (a > max) max = a;
            sum += a;
        }
        printf("%lld %lld %lld\n",min,max,sum);
    }
}